package com.hanthink.web.controller.app.task;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hanthink.common.annotation.Log;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.domain.AjaxResult;
import com.hanthink.common.enums.BusinessType;
import com.hanthink.system.domain.finishtask.EmOutgoingQualityDong;
import com.hanthink.system.service.finishtask.IEmOutgoingQualityDongService;
import com.hanthink.common.utils.poi.ExcelUtil;
import com.hanthink.common.core.page.TableDataInfo;

/**
 * -Controller
 * 
 * @author lizhao
 * @date 2023-03-28
 */
@RestController
@RequestMapping("/task/EmOutgoingQualityDong")
public class EmOutgoingQualityDongController extends BaseController
{
    @Autowired
    private IEmOutgoingQualityDongService emOutgoingQualityDongService;

    /**
     * 查询-列表
     */
    @PreAuthorize("@ss.hasPermi('system:EmOutgoingQualityDong:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmOutgoingQualityDong emOutgoingQualityDong)
    {
        startPage();
        List<EmOutgoingQualityDong> list = emOutgoingQualityDongService.selectEmOutgoingQualityDongList(emOutgoingQualityDong);
        return getDataTable(list);
    }

    /**
     * 获取当月已经完成的任务项目
     * @return
     */
    @GetMapping("/listnum")
    public long listnum(EmOutgoingQualityDong emOutgoingQualityDong)
    {
        List<EmOutgoingQualityDong> list = emOutgoingQualityDongService.selectEmOutgoingQualityDongListnum(emOutgoingQualityDong);
        return list.size();
    }

    /**
     * 导出-列表
     */
    @PreAuthorize("@ss.hasPermi('system:EmOutgoingQualityDong:export')")
    @Log(title = "-", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(EmOutgoingQualityDong emOutgoingQualityDong)
    {
        List<EmOutgoingQualityDong> list = emOutgoingQualityDongService.selectEmOutgoingQualityDongList(emOutgoingQualityDong);
        ExcelUtil<EmOutgoingQualityDong> util = new ExcelUtil<EmOutgoingQualityDong>(EmOutgoingQualityDong.class);
        return util.exportExcel(list, "EmOutgoingQualityDong");
    }

    /**
     * 获取-详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:EmOutgoingQualityDong:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(emOutgoingQualityDongService.selectEmOutgoingQualityDongById(id));
    }

    /**
     * 新增-
     */
    @PreAuthorize("@ss.hasPermi('system:EmOutgoingQualityDong:add')")
    @Log(title = "-", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmOutgoingQualityDong emOutgoingQualityDong)
    {
        return toAjax(emOutgoingQualityDongService.insertEmOutgoingQualityDong(emOutgoingQualityDong));
    }

    /**
     * 修改-
     */
    @PreAuthorize("@ss.hasPermi('system:EmOutgoingQualityDong:edit')")
    @Log(title = "-", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmOutgoingQualityDong emOutgoingQualityDong)
    {
        return toAjax(emOutgoingQualityDongService.updateEmOutgoingQualityDong(emOutgoingQualityDong));
    }

    /**
     * 删除-
     */
    @PreAuthorize("@ss.hasPermi('system:EmOutgoingQualityDong:remove')")
    @Log(title = "-", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(emOutgoingQualityDongService.deleteEmOutgoingQualityDongByIds(ids));
    }
}
